<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:s="http://jboss.com/products/seam/taglib"
	xmlns:a="http://richfaces.org/a4j"
	xmlns:rich="http://richfaces.org/rich"
	xmlns:c="http://java.sun.com/jstl/core">




	<rich:modalPanel id="firmarAnuncioModal" autosized="true" width="800"
		showWhenRendered="#{firmas.mostrarFirmar}">

		<!--  Scripts de firma	-->
		<script>
			var signerClientMapBuild = 'COMPLETA';

			function finFirma(clientSignerResult){
				document.getElementById("clientSignerResult").value = clientSignerResult;
		    }
		</script>
		<script type="text/javascript" language="javascript"
			src="#{facesContext.externalContext.requestContextPath}/common-js/clientSigner.js"></script>

		<f:facet name="header">
			<h:panelGroup>
				<h:outputText value="#{messages['titulo.modal.FirmarAnuncio']}"></h:outputText>
			</h:panelGroup>
		</f:facet>

		<h:form id="signForm">

			<rich:spacer height="20" />

			<a:mediaOutput element="pdf" mimeType="application/pdf"
				value="#{firmas.documento.bdocumento}"
				style="width:100px; height:100px;" uriAttribute="pdf"/>

			<rich:spacer height="20" />

			<a:outputPanel id="pdf" layout="block" style="text-align:center;">
				<object id="este" standby="STANDBY" type="application/pdf"
					style="height: 405px; width: 80%" data="/recepcionPortafirmas.htm">
					<p style="margin: 0 auto 0 auto; width: 80%;">#{messages['message.ForShowPdf']}</p>
				</object>
				<rich:panel style="margin:15px auto 0 auto;width: 50%;">
					<h:panelGrid columns="2">
						<h:panelGroup style="width:95%">
							#{messages['message.acrobatReader.required']}
						</h:panelGroup>
						<h:panelGroup style="width:5%">
							<h:outputLink value="http://www.adobe.com/go/getreader_es"
								target="blank">
								<h:graphicImage value="/temas/iconos/get_adobe_reader.png"
									alt="#{messages['message.acrobatReader.download']}"
									width="118px" />
							</h:outputLink>
						</h:panelGroup>
					</h:panelGrid>
				</rich:panel>
			</a:outputPanel>
			<rich:spacer height="20" />

			<input type="hidden" name="clientSignerResult"
				id="clientSignerResult" />

			<h:panelGrid columns="2">


			</h:panelGrid>
			<rich:spacer height="20" />
			<h:panelGrid columns="2">


				<a:commandButton value="FIRMAR Y YASTA"
					onclick="JSON.stringify = function(value){return value.toJSON();};sign(${clientSignerConfig}, 'finFirma');"
					actionListener="#{firmas.firmarDocumento}"
					reRender="firmarAnuncioModal" />

				<a:commandButton value="#{messages['boton.cerrar']}"
					immediate="true" actionListener="#{firmas.cerrarFirmar}"
					reRender="firmarAnuncioModal" />

			</h:panelGrid>

		</h:form>
	</rich:modalPanel>

</ui:composition>